package com.ziytek.web.citizen.mapper;

import com.ziytek.web.citizen.pojo.CommandIssued;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author fenghx
 * @version 1.0
 * @className LastCheckMapper
 * Description:
 * @date 2024/3/25 16:08
 */
@Mapper
public interface CommandIssuedMapper extends EasyBaseMapper<CommandIssued> {


    /**
     * 查询最后一条指令
     *
     * @param cabinetNo 机柜编号
     * @param boardNo    线路编号
     * @param channelNo 通道编号
     * @return CommandIssued
     */
    @Select("SELECT * FROM command_issued WHERE cabinetNo = #{cabinetNo} and boardNo = #{boardNo} and channelNo = #{channelNo} ORDER BY createTime DESC,orderNo DESC LIMIT 1")
    CommandIssued findByCommandChannel(String cabinetNo, int boardNo, Integer channelNo);

    /**
     * 查询最后一条指令
     *
     * @param cabinetNo 机柜编号
     * @return CommandIssued
     */
    @Select("SELECT * FROM command_issued WHERE cabinetNo = #{cabinetNo} and boardNo = 255 and channelNo = 255 ORDER BY createTime DESC,orderNo DESC LIMIT 1")
    CommandIssued findByCommandAll(String cabinetNo);

}
